package com.itheima.order.client;

import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient("goods-service")
public interface GoodsClient {
    @GetMapping("/goods/{goodId}")
    Result findById(@PathVariable("goodId") Long goodId);

    @PutMapping("/goods/buy")
    Result buy(@PathVariable("goodId") Long goodId,
               @RequestParam(value = "buyNum") Integer buyNum);
}
